from django.db import models


# 创建新闻分类表
class NewsCategory(models.Model):
    cag_name = models.CharField(max_length=50)

    def __str__(self):
        return "NewsCategory[cag_name=%s]" % self.cag_name


# 创建新闻信息表
class NewsInfo(models.Model):
    news_title = models.CharField(max_length=50)
    news_content = models.CharField(max_length=5000)
    news_category = models.ForeignKey(NewsCategory)

    def __str__(self):
        return "NewsInfo[news_title=%s, news_content=%s, news_category=%s]" % (
            self.news_title, self.news_content, self.news_category)
